
; This file is a complete (but stripped) mission script.

; It does 4 things:
; 1. It creates a bunch of bikes with riders driving like crazy.
; 2. It creates a thread that allows you to place waterjumps
;    (like the jumps used in the "checkpoint charlie" mission)
;    directly infront of the player in the direction the player
;    is looking.
; 3. It creates a bunch of crazy criminal pedestrians that fight
;    with everybody they see and steal whatever vehicle they can
;    get their hands on.
; 4. It creates a thread that allows you to track one of the crazy
;    bike riders by pressing the ACTION key.
;


DEFINE VERSION VICE 1.3

0002: jump SecondSegment 
DEFINE MEMORY 34329   ;; A bit too much maby...

:SecondSegment
0002: jump ThirdSegment 
DEFINE OBJECTS 3
DEFINE OBJECT (no name)      ;; This is an unused object. You can put anything here.
DEFINE OBJECT WATERJUMPX2                 ;; Object number -1
DEFINE OBJECT WATERJUMP1                  ;; Object number -2

:ThirdSegment
0002: jump LabelMAIN 
DEFINE MISSIONS 0

;-------------MAIN---------------

:LabelMAIN
03A4: name_thread "MAIN" 
016A: fade 0  0 ms 
01F0: set_max_wanted_level_to 6 
0111: set_wasted_busted_check_to 0 (disabled)  
00C0: set_current_time 12 0 
04E4: unknown_refresh_game_renderer_at 83.0 -849.8 
03CB: set_camera 83.0 -849.8 9.3 
0053: $PLAYER_CHAR = create_player #NULL at 80.0 -849.8 9.3 
01F5: $PLAYER_ACTOR = create_emulated_actor_from_player $PLAYER_CHAR 
0001: wait 0 ms 
01B6: set_weather 0 
00D6: if 0 
8118:   NOT   actor $PLAYER_ACTOR dead 
004D: jump_if_false LabelMAIN2 
0352: set_actor $PLAYER_ACTOR skin_to "PLAYER" 
038B: load_requested_models 
0353: refresh_actor $PLAYER_ACTOR 

:LabelMAIN2
016A: fade 1 (back)  1000 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false LabelMAIN3 
04BB: select_interiour 0  ;; select render area 
01B4: set_player $PLAYER_CHAR frozen_state 1 (unfrozen)  
01B7: release_weather 

004F: create_thread RandomTraffic  
004F: create_thread WaterJumpMod  
004F: create_thread Peds  
004F: create_thread FollowRider  

:LabelMAIN3
0001: wait 2500 ms 
0002: jump LabelMAIN3 

:FollowRider
0001: wait 0 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false FollowRider 
00D6: if 0 
8118:   NOT   actor $TBikeRider0 dead 
004D: jump_if_false FollowRider 
00D6: if 0 
00DF:   actor $TBikeRider0 driving 
004D: jump_if_false FollowRider 
00D6: if 0 
00E1:   key_pressed 0 4 
004D: jump_if_false FollowRider2 
00AD: set_car $TBike0 max_speed_to 60.0 
04C4: create_coordinate 1@ 2@ 3@ from_actor $TBikeRider0 offset 0.0 0.0 0.5 
04C4: create_coordinate 4@ 5@ 6@ from_actor $TBikeRider0 offset 0.0 -3.0 0.5 
015F: set_camera_position 4@ 5@ 6@ 0.0 0.0 0.0 
0160: point_camera 1@ 2@ 3@ 2 
04C4: create_coordinate 4@ 5@ 6@ from_actor $TBikeRider0 offset 0.0 -5.0 3.5 
00A0: store_actor $TBikeRider0 position_to 4@ 5@ 6@ 
6@ += 10.0
0055: put_player $PLAYER_CHAR at 4@ 5@ 6@ 
04D7: lock_actor $PLAYER_ACTOR in_current_position 1 
0002: jump FollowRider 

:FollowRider2
02EB: restore_camera_with_jumpcut 
04D7: lock_actor $PLAYER_ACTOR in_current_position 0 
0002: jump FollowRider 

define array $Peds 30 integer

:Peds
$Peds_index = 0

:Peds2
0001: wait 250 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false Peds2 
0054: store_player $PLAYER_CHAR position_to 1@ 2@ 3@ 
0208: 5@ = random_float -100.0 100.0 
0208: 6@ = random_float -100.0 100.0 
0007: 7@ = 0.0  ;; floating-point values 
005B: 5@ += 1@  ;; floating-point values (never used in VC or GTA 3) 
005B: 6@ += 2@  ;; floating-point values (never used in VC or GTA 3) 
02C0: set 5@ 6@ 7@ to_ped_path_coords_closest_to 5@ 6@ 7@ 

get_array $Peds
00D6: if 0 
8118:   NOT   actor $Peds dead 
004D: jump_if_false Peds3 
00D6: if 0 
80E9:   NOT   player $PLAYER_CHAR 0 near_actor $Peds radius 100.0 100.0 
004D: jump_if_false Peds5 

:Peds3
01C2: remove_references_to_actor $Peds  ;; Like turning an actor into a random pedestrian 
0209: 0@ = random_int 9 82 
0247: request_model 0@ 

:Peds4
0001: wait 0 ms 
00D6: if 0 
0248:   model 0@ available 
004D: jump_if_false Peds4 
009A: $Peds = create_actor 4 0@ at 5@ 6@ 7@ 
01ED: reset_actor $Peds flags 
0243: set_actor $Peds ped_stats_to 16 
011A: set_actor $Peds flags 2 
011A: set_actor $Peds flags 4 
011A: set_actor $Peds flags 8 
011A: set_actor $Peds flags 16 
011A: set_actor $Peds flags 32 
011A: set_actor $Peds flags 64 
011A: set_actor $Peds flags 128 
011A: set_actor $Peds flags 256 
011A: set_actor $Peds flags 512 
011A: set_actor $Peds flags 1024 
011A: set_actor $Peds flags 2048 
011A: set_actor $Peds flags 4096 
011A: set_actor $Peds flags 8192 
011A: set_actor $Peds flags 16384 
011A: set_actor $Peds flags 65536 
011A: set_actor $Peds flags 131072 
011A: set_actor $Peds flags 262144 
011A: set_actor $Peds flags 524288 
011A: set_actor $Peds flags 1048576 
011A: set_actor $Peds flags 2097152 
011A: set_actor $Peds flags 4194304 
011A: set_actor $Peds flags 16777216 
0291: unknown_actor $Peds unknown_behavior_flag 1 
0249: release_model 0@ 
set_array $Peds

:Peds5
$Peds_index += 1
if $Peds_index > 30   ;; controls the amount of cars used
jump_if_false Peds2
jump Peds


:WaterJumpMod
0004: $WaterJumpObject = -2  ;; integer values 

:WaterJumpMod2
0001: wait 250 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false WaterJumpMod2 
00D6: if 0 
00E1:   key_pressed 0 19 
004D: jump_if_false WaterJumpMod2 
04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 5.0 0.0 
0170: 4@ = player $PLAYER_CHAR z_angle 
01C4: remove_references_to_object 0@  ;; This object will now disappear when the player looks away 
029B: 0@ = init_object $WaterJumpObject at 1@ 2@ 3@ 
0177: set_object 0@ z_angle_to 4@ 

:WaterJumpMod3
0001: wait 250 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false WaterJumpMod3 
00D6: if 0 
80E1:   NOT   key_pressed 0 19 
004D: jump_if_false WaterJumpMod3 
0002: jump WaterJumpMod2 

define array $TBike 30 integer
define array $TBikeRider 30 integer

:RandomTraffic
0001: wait 0 ms 
$TBike_index = 0  ;; integer values
$TBikeRider_index = 0  ;; integer values

:RandomTraffic2
0001: wait 100 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false RandomTraffic2 
get_array $TBike
get_array $TBikeRider
00D6: if 0 
8119:   NOT   car $TBike wrecked 
004D: jump_if_false RandomTraffic5 
00D6: if 0 
8118:   NOT   actor $TBikeRider dead 
004D: jump_if_false RandomTraffic92 
00D6: if 0 
00DF:   actor $TBikeRider driving 
004D: jump_if_false RandomTraffic92 
00D6: if 0 
01FC:   player $PLAYER_CHAR near_car $TBike radius 250.0 250.0 0 
004D: jump_if_false RandomTraffic9 

0002: jump GetNewIndexes 

:RandomTraffic92
01C2: remove_references_to_actor $TBikeRider  ;; Like turning an actor into a random pedestrian 
01C3: remove_references_to_car $TBike  ;; Like turning a car into any random car 
0002: jump RandomTraffic8 

:RandomTraffic9
009B: destroy_actor_instantly $TBikeRider 
00A6: destroy_car $TBike 
0002: jump RandomTraffic8 

:RandomTraffic5
009B: destroy_actor_instantly $TBikeRider 
01C3: remove_references_to_car $TBike  ;; Like turning a car into any random car 

:RandomTraffic8
00D6: if 0 
00E0:   player $PLAYER_CHAR driving 
004D: jump_if_false RandomTraffic8_2 
04C4: create_coordinate 2@ 3@ 4@ from_actor $player_actor offset 0.0 250.0 0.0   ;; one way
; 04C4: create_coordinate 2@ 3@ 4@ from_actor $player_actor offset 0.0 -155.0 0.0  ;; other way
0002: jump RandomTraffic8_3 

:RandomTraffic8_2
0054: store_player $PLAYER_CHAR position_to 2@ 3@ 4@ 

:RandomTraffic8_3
0208: 5@ = random_float -150.0 150.0 
0208: 6@ = random_float -150.0 150.0 
0007: 7@ = 0.0  ;; floating-point values 
005B: 5@ += 2@  ;; floating-point values (never used in VC or GTA 3) 
005B: 6@ += 3@  ;; floating-point values (never used in VC or GTA 3) 
02C1: set 5@ 6@ 7@ to_car_path_coords_closest_to 5@ 6@ 7@ 
00D6: if 0 
038A:   car_in_cube 5@ 6@ 7@ 4.0 4.0 3.0 
004D: jump_if_false RandomTraffic88 
0001: wait 0 ms 
0002: jump RandomTraffic8 

:RandomTraffic88
0001: wait 0 ms 
0209: 9@ = random_int 1 5 
00D6: if 0 
0039:   9@ == 1  ;; integer values 
004D: jump_if_false RandomTraffic882 
0006: 9@ = #angel  ;; integer values 
0002: jump GotRTModel 

:RandomTraffic882
00D6: if 0 
0039:   9@ == 2  ;; integer values 
004D: jump_if_false RandomTraffic883 
0006: 9@ = #pizzaboy  ;; integer values 
0002: jump GotRTModel 

:RandomTraffic883
00D6: if 0 
0039:   9@ == 3  ;; integer values 
004D: jump_if_false RandomTraffic884 
0006: 9@ = #pcj600  ;; integer values 
0002: jump GotRTModel 

:RandomTraffic884
00D6: if 0 
0039:   9@ == 4  ;; integer values 
004D: jump_if_false RandomTraffic88 
0006: 9@ = #rcbandit  ;; integer values 

:GotRTModel
0247: request_model 9@ 
0209: 10@ = random_int 9 82 
0247: request_model 10@ 

:RTgettaxi
0001: wait 0 ms 
00D6: if 1 
0248:   model 9@ available 
0248:   model 10@ available 
004D: jump_if_false RTgettaxi 
00A5: $TBike = create_car 9@ at 5@ 6@ -100.0 
0208: 5@ = random_float 0.0 359.0 
0175: set_car $TBike z_angle_to 5@ 
0129: $TBikeRider = create_actor 4 10@ in_car $TBike driverseat 
0208: 5@ = random_float 30.0 60.0 
00AD: set_car $TBike max_speed_to 5@ 
00AE: unknown_set_car $TBike to_ignore_traffic_lights 2 
0249: release_model 9@ 
0249: release_model 10@ 
set_array $TBike
set_array $TBikeRider

:GetNewIndexes
$TBike_index += 1
0084: $TBikeRider_index = $TBike_index  ;; integer values and handles 
if $TBike_index > 30   ;; controls the amount of cars used
jump_if_false RandomTraffic2
jump RandomTraffic
